package com.jhws.business.car.controller;

import com.jhws.common.base.bo.JsonRespData;
import com.jhws.business.car.service.CarEnteringRecordServic;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.Map;

@Controller
@RequestMapping("/car/carEnteringRecord")
public class CarEnteringRecordController {
    @Resource
    private CarEnteringRecordServic carEnteringRecordServic;

    @RequestMapping("queryEnteringRecordList.x")
    @ResponseBody
    public Map queryCarInfoList(@RequestParam Map param) throws Exception {
        return carEnteringRecordServic.queryCarEnteringRecordLog(param);
    }

    /**
     * 获取场内车辆
     *
     * @param parkId
     * @return
     */
    @RequestMapping("queryCarEnteringRecord.x")
    @ResponseBody
    public JsonRespData queryCarEnteringRecord(String parkId) {
        return new JsonRespData("", 1, carEnteringRecordServic.queryCarEnteringRecord(parkId));
    }

    /**
     * 获取场内车辆数量
     *
     * @param parkId
     * @return
     */
    @RequestMapping("queryCarEnteringRecordSize.x")
    @ResponseBody
    public JsonRespData queryCarEnteringRecordSize(String parkId) {
        return new JsonRespData("", 1, carEnteringRecordServic.queryCarEnteringRecordSize(parkId));
    }

    /**
     * 删除场内车辆记录
     * @param parkId
     * @return
     */
    @RequestMapping("deleteCarEntering.x")
    @ResponseBody
    public JsonRespData deleteCarEntering(String parkId, String plateNumber) {
        carEnteringRecordServic.deleteCarEntering(parkId, plateNumber);
        return new JsonRespData("", 1, "");
    }
}
